import os, re, shutil

dest_path = '/usr/local/solrmp3'


# move files

shutil.rmtree(dest_path)
shutil.copytree(os.getcwd(), dest_path)


# modify configuration

temp_path = os.path.join(dest_path, 'src/temp.conf')

f = open(temp_path, 'w')

conf_path = os.path.join(dest_path, 'src/cherrypy.conf')
data = open(conf_path).read()
f.write(re.sub('server.socket_host = "127.0.0.1"', 'server.socket_host = "192.168.1.108"', data))

f.close()

shutil.move(temp_path, conf_path)